

package com.hazelcast.internal.cluster.impl.operations;

import com.hazelcast.instance.impl.Node;
import com.hazelcast.internal.cluster.impl.ClusterDataSerializerHook;
import com.hazelcast.logging.ILogger;
import com.hazelcast.spi.impl.NodeEngine;

public class AuthenticationFailureOp extends AbstractClusterOperation {

    public AuthenticationFailureOp() {
    }

    @Override
    public void run() {
        final NodeEngine nodeEngine = getNodeEngine();
        final Node node = nodeEngine.getNode();
        JoinOperation.verifyCanShutdown(node, "Authentication failed on master node!");
        final ILogger logger = nodeEngine.getLogger("com.hazelcast.security");
        logger.severe("Node could not join cluster. Authentication failed on master node! Node is going to shutdown now!");
        node.shutdown(true);
    }

    @Override
    public int getClassId() {
        return ClusterDataSerializerHook.AUTH_FAILURE;
    }
}
